﻿using System.Data.Objects.DataClasses;

namespace FPP.Models
{
    public partial class BachelorPerson : EntityObject, IValidate
    {
        public int BachelorGameId { get; set; }
        public string Name { get; set; }
        public bool IsBachelor { get; set; }

        public bool Validate(ChangeAction action)
        {
            switch (action)
            {
                case ChangeAction.Insert:
                    if (string.IsNullOrEmpty(Name)) return false;
                    if (BachelorGameId == 0) return false;
                    break;
            }

            return true;
        }

        public override bool Equals(object obj)
        {
            var compare = (BachelorPerson)obj;
            return BachelorGameId == compare.BachelorGameId
                    && Name == compare.Name
                    && IsBachelor == compare.IsBachelor;
        }

        public override int GetHashCode()
        {
            return BachelorGameId;
        }
    }
}